library htmldoc.html_generator;

import 'dart:async' show Future, StreamController, Stream;

import '../generator.dart';
import 'html_generator_instance.dart';
import 'templates.dart';

typedef String Renderer(String input);

class HtmlGenerator extends Generator {
  final Templates _templates;

  static Future<HtmlGenerator> create(
      {List<String> headers,
      List<String> footers}) async {
    var templates =
      await Templates.create(headerPaths: headers, footerPaths: footers);

    return new HtmlGenerator._(templates);
  }

  HtmlGenerator._(this._templates);

  @override
  String generate(int pageIndex) {
    return new HtmlGeneratorInstance(_templates).generate(pageIndex);
  }
}
